package com.araaya.eslimsmobile;

import com.araaya.eslimsmobile.R;

import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebView;

public class WebActivity extends Activity {

    WebView mWebView;

    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        final Activity mActivity = this;
        super.onCreate(savedInstanceState);

        // Adds Progrss bar Support
        this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
        setContentView(R.layout.web_home);


        // Makes Progress bar Visible
        getWindow().setFeatureInt( Window.FEATURE_PROGRESS, Window.PROGRESS_VISIBILITY_ON);

        mWebView = (WebView) findViewById( R.id.webview );
        mWebView.getSettings().setJavaScriptEnabled(true);     
        mWebView.loadUrl("http://192.168.1.100:8080/eLand");


        mWebView.setWebChromeClient(new WebChromeClient() 
        {
            public void onProgressChanged(WebView view, int progress)  
            {
                //Make the bar disappear after URL is loaded, and changes string to Loading...
                mActivity .setTitle("Loading...");
                mActivity .setProgress(progress * 100); //Make the bar disappear after URL is loaded

                // Return the app name after finish loading
                if(progress == 100)
                {
                    //financialPortalActivity.setTitle(R.string.app_name);
                }
            }
        });
    }
}

